home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-02 | 1.3 KB | 26 lines | [TEXT/CCL2] |
- ;; font-menus-patch.lisp
- ;; This is a source patch for the file "examples;font-menus.lisp"
- ;; It prevents an error when clicking in the menubar when there are no
- ;; windows opened.
-
- (in-package :ccl) ; in case someone EVALs this buffer
-
- (defmethod menu-item-update ((item font-menu-item))
- (multiple-value-bind (current-font first-character-font)
- ;; some views only return the current font
- (let ((w (front-window)))
- (and w (view-font w)))
- (let ((selection-font (or first-character-font current-font))
- (my-attribute (slot-value item 'my-attribute)))
- (set-menu-item-check-mark item
- (not (not (member my-attribute
- selection-font
- :test #'equalp))))
- (when (and selection-font
- (integerp my-attribute)) ; if it's a size attribute
- (set-menu-item-style item
- (if (real-font (substitute-if my-attribute
- #'integerp
- selection-font))
- :outline
- :plain))))))